<?php
/**
 * [LupMisNotAllowedSync]
 * 本代码为系统自动生成代码，请根据自己业务进行修改;
 * 生成时间 2022-02-15 20:59:20;
 * 版权所有 2020-2022 lizhongwen，并保留所有权利;
 * 说明: 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用；不允许对程序代码以任何形式任何目的的再发布;
 * 作者: 中文Lee;
 * 作者主页: http://www.lizhongwen.com;
 * 邮箱: 360811363@qq.com;
 * QQ: 360811363;
 */

namespace modules\sys\component;


use application\core\RedisUtil;
use modules\sys\mapper\ActionMapper;
use modules\sys\mapper\CatalogMapper;
use modules\sys\mapper\ConfigMapper;
use modules\sys\mapper\DictDataMapper;
use modules\sys\mapper\DictMapper;
use modules\sys\mapper\FieldMapper;
use modules\sys\mapper\PageMapper;
use modules\sys\mapper\RoleMapper;
use modules\sys\mapper\TableMapper;
use modules\sys\mapper\TreeMapper;

class SetCacheComponent
{
    public static function table()
    {
        if (REDIS_ENABLE) {
            $tableLists = TableMapper::lists();
            RedisUtil::instance()->set('sys_table', json_encode($tableLists, JSON_UNESCAPED_UNICODE));
        }
    }

    public static function tree()
    {
        if (REDIS_ENABLE) {
            $treeLists = TreeMapper::lists();
            RedisUtil::instance()->set('sys_tree', json_encode($treeLists, JSON_UNESCAPED_UNICODE));
        }
    }

    public static function page()
    {
        if (REDIS_ENABLE) {
            $pageLists = PageMapper::lists();
            RedisUtil::instance()->set('sys_page', json_encode($pageLists, JSON_UNESCAPED_UNICODE));
        }
    }

    public static function action()
    {
        if (REDIS_ENABLE) {
            $actionLists = ActionMapper::lists();
            RedisUtil::instance()->set('sys_action', json_encode($actionLists, JSON_UNESCAPED_UNICODE));
        }
    }


    public static function role()
    {
        if (REDIS_ENABLE) {
            $roleLists = RoleMapper::lists();
            RedisUtil::instance()->set('sys_role', json_encode($roleLists, JSON_UNESCAPED_UNICODE));
        }
    }

    public static function field()
    {
        if (REDIS_ENABLE) {
            $fieldLists = FieldMapper::lists();
            RedisUtil::instance()->set('sys_field', json_encode($fieldLists, JSON_UNESCAPED_UNICODE));
        }
    }

    public static function dict()
    {
        if (REDIS_ENABLE) {
            $dictLists = DictMapper::lists();
            RedisUtil::instance()->set('sys_dict', json_encode($dictLists, JSON_UNESCAPED_UNICODE));
        }
    }

    public static function dictData()
    {
        if (REDIS_ENABLE) {
            $dictDataLists = DictDataMapper::lists();
            RedisUtil::instance()->set('sys_dict_data', json_encode($dictDataLists, JSON_UNESCAPED_UNICODE));
        }
    }

    public static function config()
    {
        if (REDIS_ENABLE) {
            $config = ConfigMapper::query();
            RedisUtil::instance()->set('sys_config', json_encode($config, JSON_UNESCAPED_UNICODE));
        }
    }

    public static function catalog()
    {
        if (REDIS_ENABLE) {
            $catalogLists = CatalogMapper::lists();
            RedisUtil::instance()->set('sys_catalog', json_encode($catalogLists, JSON_UNESCAPED_UNICODE));
        }
    }
}